package com.chuantou.yuba.ui;

import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.support.v4.app.FragmentManager;
import android.support.v4.app.FragmentTransaction;

import com.chuantou.yuba.R;
import com.chuantou.yuba.ui.fragment.TrendsFragment;
import com.chuantou.yuba.util.Constants;

/**
 * 个人动态界面
 * 
 * @author Administrator
 * 
 */
public class TrendsListActivity extends BaseActionBarActivity {
	private String mTitle;
	private long mTargetUid;

	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		mTitle = getIntent().getStringExtra(Constants.EXTRA_TITLE);
		setContentView(R.layout.trends_list);
		mTargetUid = getIntent().getLongExtra(Constants.EXTRA_TARGET_UID, 0L);
		TrendsFragment fragment = new TrendsFragment();
		Bundle args = new Bundle();
		args.putLong(Constants.EXTRA_TARGET_UID, mTargetUid);
		fragment.setArguments(args);
		FragmentManager manager = getSupportFragmentManager();
		FragmentTransaction transaction = manager.beginTransaction();
		transaction.add(R.id.content, fragment, TrendsFragment.class.getSimpleName());
		transaction.commitAllowingStateLoss();
		setTitle(mTitle);
	}

	public static void start(Activity activity,String title, long targetUid) {
		Intent intent = new Intent(activity, TrendsListActivity.class);
		intent.putExtra(Constants.EXTRA_TARGET_UID, targetUid);
		intent.putExtra(Constants.EXTRA_TITLE, title);
		activity.startActivity(intent);
	}

}
